Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GR-43971] Support native-image environment variable capturing in bundles. #6095

Merged
merged 16 commits into from
Mar 7, 2023

Conversation

graalvmbot
Copy link
Collaborator

@graalvmbot graalvmbot commented Mar 1, 2023

This PR

  • Adds native-image option -E<env-var-key>[=<env-var-value>] and
  • Support for environment variable capturing in bundles.

Previously almost all environment variables were simply forwarded to the builder. With this PR we changed the behavior to only have a minimum set of environment variables passed through to the builder. If an image build requires additional access to environment variables during image build-time, the new option

-E<env-var-key>[=<env-var-value>]
                      allow native-image to access the given environment variable during
                      image build. If the optional <env-var-value> is not given, the value
                      of the environment variable will be taken from the environment
                      native-image was invoked from.

has to be used.

To temporarily revert back to the old behaviour, env setting NATIVE_IMAGE_DEPRECATED_BUILDER_SANITATION=true can be used. The old behavior might get removed in a future release.

💡 If you experience image build errors after this PR and using NATIVE_IMAGE_DEPRECATED_BUILDER_SANITATION=true make the errors go away you determined that your image build depends on custom environment variables. Please identify those env-vars and add them to your image build options (with -E).

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 1, 2023
@graalvmbot graalvmbot force-pushed the paw/GR-43971 branch 2 times, most recently from 44db22a to 88952c6 Compare March 2, 2023 14:08
github-actions bot pushed a commit to Mic92/nixpkgs that referenced this pull request Dec 17, 2023
…of CC wrapper

Instead of using a hacky CC wrapper to re-inject the environment
variables needed to build, we set the
NATIVE_IMAGE_DEPRECATED_BUILDER_SANITATION=true that is in 21.0.0
release changelog:
https://github.com/oracle/graal/blob/489611a304ec808cdcb1e07e9a9799e6240fd2e1/substratevm/CHANGELOG.md?plain=1#L48

This is deprecated behavior for now, and will be removed in future, but
this will allow us more time until we figure a proper solution.

See:
- oracle/graal#7502
- oracle/graal#7981
- oracle/graal#6095
hamburger1984 pushed a commit to hamburger1984/nixpkgs that referenced this pull request Dec 18, 2023
…of CC wrapper

Instead of using a hacky CC wrapper to re-inject the environment
variables needed to build, we set the
NATIVE_IMAGE_DEPRECATED_BUILDER_SANITATION=true that is in 21.0.0
release changelog:
https://github.com/oracle/graal/blob/489611a304ec808cdcb1e07e9a9799e6240fd2e1/substratevm/CHANGELOG.md?plain=1#L48

This is deprecated behavior for now, and will be removed in future, but
this will allow us more time until we figure a proper solution.

See:
- oracle/graal#7502
- oracle/graal#7981
- oracle/graal#6095
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Native Image Build Bundles
2 participants